#pragma once
#include <iostream>
/**
 * define a create function for a specific type, such as CCLayer
 * @__TYPE__ class type to add create(), such as CCLayer
 */
#define CREATE_FUNC(__TYPE__) \
static __TYPE__* create() \
{ \
    __TYPE__ *pRet = new __TYPE__(); \
    if (pRet && pRet->init()) \
    { \
        pRet->autorelease(); \
        return pRet; \
    } \
    else \
    { \
        delete pRet; \
        pRet = NULL; \
        return NULL; \
    } \
}

class MacroTest {
public:
	MacroTest();
	~MacroTest();

	bool init() {return true;}
	void autorelease() {std::cout << "autorelease" << std::endl;}

	CREATE_FUNC(MacroTest)

	void runTest();

};